Skip to content

Add cross-platform code coverage tooling + CI wiring#990

Draft
johnml1135 wants to merge 3 commits into
mainfrom
coverage-tooling-ci
Draft

Add cross-platform code coverage tooling + CI wiring#990
johnml1135 wants to merge 3 commits into
mainfrom
coverage-tooling-ci

Conversation

@johnml1135

@johnml1135 johnml1135 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The existing /EnableCodeCoverage MSBuild flag (Build/SetupInclude.targets) depends on a VS-Enterprise-only "Code Coverage" data collector and silently fails to collect on Community/Build Tools installs (confirmed live: vstest.console.exe reports Unable to find a datacollector with friendly name 'Code Coverage').
  • Add coverlet.collector instead, which registers the cross-platform "XPlat Code Coverage" collector and works under plain vstest.console.exe on any VS edition.
  • Add a -Coverage switch to test.ps1 that collects coverage (resolving coverlet's TestAdapterPath from the centrally-pinned package version, same pattern as the existing NUnit adapter lookup) and renders a summary/HTML report via a local ReportGenerator dotnet tool (.config/dotnet-tools.json).
  • Wire -Coverage into CI.yml's test step and upload the rendered report as a build artifact.
  • test.ps1 now runs dotnet tool restore before invoking ReportGenerator so a fresh checkout/CI runner doesn't just warn and skip the report.
  • Add the fieldworks-test-coverage skill (how to check that new/changed lines are actually exercised, not just that a test file exists nearby) and reference it from execute-implement/verify-test and the base rubric's test_coverage criterion.

Test plan

  • .\build.ps1 — full solution build, clean
  • .\test.ps1 -TestProject "Src/Common/FwUtils/FwUtilsTests" -Coverage on this branch (built against plain main, not any feature branch) — 375/375 tests passed, coverage collected and summary/HTML report rendered correctly
  • Confirmed the previous /EnableCodeCoverage flag does not work on a VS 2022 Community install (motivates the coverlet switch)

🤖 Generated with Claude Code


This change is Reviewable

johnml1135 and others added 2 commits July 3, 2026 14:57
The existing /EnableCodeCoverage MSBuild flag (Build/SetupInclude.targets)
depends on a VS-Enterprise-only "Code Coverage" data collector and
silently fails to collect on Community/Build Tools installs (confirmed
live: vstest.console.exe reports "Unable to find a datacollector").

Add coverlet.collector instead, which registers the cross-platform
"XPlat Code Coverage" collector and works under plain vstest.console.exe
on any VS edition. Wire a `-Coverage` switch into test.ps1 that collects
coverage (per-project TestAdapterPath resolved from the centrally-pinned
package version, same pattern as the existing NUnit adapter lookup) and
renders a summary/HTML report via a local ReportGenerator dotnet tool
(.config/dotnet-tools.json).

Add the fieldworks-test-coverage skill (how to check that new/changed
lines are actually exercised, not just that a test file exists nearby)
and reference it from execute-implement/verify-test and the base
rubric's test_coverage criterion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add -Coverage to the CI test.ps1 invocation and upload the rendered
summary/HTML report as a build artifact. Have test.ps1 run
`dotnet tool restore` before invoking ReportGenerator so a fresh
checkout (CI runners, new clones) doesn't just warn and skip the
report because the local tool manifest was never restored.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

NUnit Tests

1 files  ±    0  1 suites  ±0   0s ⏱️ - 10m 42s
0 tests  - 4 299  0 ✅  - 4 226  0 💤  - 73  0 ❌ ±0 
0 runs   - 4 308  0 ✅  - 4 235  0 💤  - 73  0 ❌ ±0 

Results for commit 0f78266. ± Comparison against base commit 906e569.

♻️ This comment has been updated with latest results.

coverlet.collector's XPlat Code Coverage data collector instruments
every module with a matching .pdb next to the test assembly. FieldWorks
test projects share one Output/<Configuration> folder rather than
per-project bin folders, so with the default MaxCpuCount=0 (parallel
testhosts), two testhosts raced to instrument/restore the same shared
product DLL (e.g. XMLViews.dll), failing CI with "being used by
another process". Force MaxCpuCount=1 in a coverage-only runsettings
clone so coverage runs execute test assemblies serially.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@johnml1135 johnml1135 marked this pull request as draft July 8, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant